function MouseInputDevice(canvas) {
    this.x = 0;
    this.y = 0;
    this.btn1 = false;
    this.btn2 = false;
    this.btn3 = false;
    this.$canvas = $(canvas);
    var self = this;

    canvas.onmousemove = function(e) {
        var offset = self.$canvas.offset();
        self.x = e.clientX - offset.left;
        self.y = e.clientY - offset.top;
    };

    canvas.onmousedown = function(e) {
        if(e.which == 1) {
            self.btn1 = true;
        } else if(e.which == 2) {
            self.btn2 = true;
        } else if(e.which == 3) {
            self.btn3 = true;
        }
    };

    canvas.onmouseup = function(e) {
        if(e.which == 1) {
             self.btn1 = false;
        } else if(e.which == 2) {
             self.btn2 = false;
        } else if(e.which == 3) {
             self.btn3 = false;
        }
    }
}